<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>查看章节</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css">
</head>
<body>
<nav th:replace="teacher/_fragments :: menu(1)" class="ui inverted  segment">
    <div class="ui container">
        <div class="ui inverted  secondary stackable menu">
            <h2 class="ui teal header item">CUMT</h2>
            <h3 class="ui teal header item">在线答题系统</h3>
            <a href="#" class=" item ">章节</a>
            <a href="#" class=" item ">知识点</a>
            <a href="#" class=" item ">题目</a>
            <a href="#" class=" item ">试卷</a>
            <a href="#" class=" item ">成绩</a>

            <div class="right menu   ">
                <div class="ui dropdown item">
                    <div class="text">
                        Zhaohaihang
                    </div>
                    <i class="dropdown icon"></i>
                    <div class="menu">
                        <a href="#" class="item">注销</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</nav>

<div class="ui  container">

    <div class="ui success message" th:unless="${#strings.isEmpty(message)}">
        <i class="close icon "></i>
        <div class="header">提示：</div>
        <P th:text="${message}">操作成功</P>
    </div>

    <table class="ui celled compact teal table">
        <thead>
        <tr >
            <th>序号</th>
            <th>id</th>
            <th>章节号</th>
            <th>章节名称</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <tr th:each="chapter,iterStat : ${page.content}">
            <td th:text="${iterStat.count}">1</td>
            <td th:text="${chapter.id}">156</td>
            <td th:text="${chapter.chapterNum}">第一章</td>
            <td th:text="${chapter.chapterName}">数组</td>
            <td>
                <a href="#" th:href="@{/teacher/tea-chapter/{id}/input(id=${chapter.id})}" class="ui mini basic orange button">编辑</a>
                <a href="#" th:href="@{/teacher/tea-chapter/{id}/delete(id=${chapter.id})}" class="ui mini basic red button">删除</a>
            </td>
        </tr>
        </tbody>
        <tfoot>
        <tr>
            <th colspan="7">
                <div class="ui  mini  pagination menu" th:if="${page.totalPages}>1">
                    <a href="#" th:href="@{/teacher/tea-chapter(page=${page.number}-1)}" class=" item" th:unless="${page.first}">上一页</a>
                    <a href="#" th:href="@{/teacher/tea-chapter(page=${page.number}+1)}" class=" item" th:unless="${page.last}">下一页</a>
                </div>
                <a href="" th:href="@{/teacher/tea-chapter/input}" class="ui orange right floated mini basic button">新增</a>
            </th>
        </tr>
        </tfoot>
    </table>
</div>



<script src="https://cdn.jsdelivr.net/npm/jquery@3.2/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.js"></script>

<script>
    $('.ui.dropdown').dropdown({
        on: 'hover'
    });

    //消息提示初始化
    $('.message .close').on('click',function(){
        $(this).closest('.message')
            .transition('fade');
    })
</script>
</body>
</html>